package com.itheima.tlias84.dao.mapper;

import com.itheima.tlias84.controller.po.InsertEmpParam;
import com.itheima.tlias84.controller.po.SelectEmpPageParam;
import com.itheima.tlias84.dao.entity.Emp;
import com.itheima.tlias84.service.dto.SelectEmpAndExprDTO;
import com.itheima.tlias84.service.dto.SelectEmpDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface EmpMapper {

    List<Emp> selectAll();

    List<SelectEmpDTO> selectPage(@Param("p") SelectEmpPageParam param);

    SelectEmpAndExprDTO selectById(@Param("id") Integer id);

    @Select("select id, name, username, password from emp where username = #{u}")
    Emp selectByUsername(@Param("u") String username);

    int deleteEmp(@Param("ids") List<Integer> list);

    int insertEmp(@Param("emp") InsertEmpParam param);

    int updateEmp(@Param("emp") InsertEmpParam param);
}
